<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title>菜单</title>
    <style type="text/css">

    </style>
</head>

<body>
    <div class="nav">
        <ul>
            <li a href="#">首页</li>
            <li a href="#">免费资源</li>
            <li a href="#">课程中心</li>
            <li a href="#">IT学院</li>
            <li a href="#">学员做事</li>
            <li a href="#">线上学院</li>
        </ul>
    </div>
<script>
    var menuList = ['首页','免费资源','课程中心','IT学院','学员做事','线上学院'];
    var str ='<ul>';
    for(var item of menuList){
        str +="<li><a href='#'>"+item"</a></li>";
    }
    str+"</ul>";
    document.write(str)
</script>

</body>
</html>